package com.kizuki.design.chain2;

import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * spring注入形式的责任链
 */
@Service
public class Chain2Service {

    /**
     * 通过@Order注解保证放进来的顺序
     */
    @Resource
    private List<AbstractHandler> handlers;

    public void handle(PeopleContent peopleContent) {
        for (AbstractHandler h : handlers) {
            h.handle(peopleContent);
        }
    }
}

